****************************
**	Replication do-file for "Governmment Policies and the Emergence of an Ethnic Dimension in Party Systems"
**	Author: Maayan Mor
**  APPENDIX I
****************************

clear all
set more off

/* SET DIRECTORY */

use "Rifle clubs.dta", clear

**		Figure I3
egen schutzverein_tot=total(schutzverein), by(year)
sort schutzverein_tot
label var schutzverein_tot "No. of Rifle Clubs"
label var year "Election Year"

scatter schutzverein_tot year, m(i) connect(line) graphregion(color(white)) ylabel(, labsize(4.5)) ///
ytitle(, size(5)) xtitle(, size(5)) ///
name(sv_tot, replace) xlabel(1849 1852 1855 1858 1861 1862 1863 1866 1867 1870 1873, labsize(4) alternate)
graph export "sv_number.png", replace

drop if year==1867
encode province, gen(pv)

gen priest_ln=ln(priest_vicar)

**		Priests. This produces panel a.
reg p_ c.cathp_64 i.year##c.priest_ln sv_l DM_t i.pv, 
estadd local rsq=round(e(r2), .01)
estadd local radj=round(e(r2_a), .01)
eststo priest

coefplot, drop(_cons DM_t priest_ln sv_l cathp_64 1852.year 1855.year 1858.year 1861.year 1862.year 1863.year 1866.year  1870.year 1873.year  *.pv) vertical yline(0, lc(gs0)) graphregion(color(white)) xlabel(1(1)10, labsize(5)) ylabel(, labsize(5)) name(priest, replace) title("")  ///
xline(0.85, lc(gs8) lp(shortdash_dot)) xline(1.15, lc(gs6) lp(shortdash_dot)) ///
xline(3.85, lc(gs8) lp(shortdash_dot)) xline(4.15, lc(gs6) lp(shortdash_dot)) ///
xline(7.85, lc(gs8) lp(shortdash_dot)) xline(8.15, lc(gs6) lp(shortdash_dot)) ///
xline(8.85, lc(gs8) lp(shortdash_dot)) xline(9.15, lc(gs6) lp(shortdash_dot)) xlabel(1 "1852" 2 "1855" 3 "1858" 4 "1861" 5 "1862" 6 "1863" 7 "1866" 8 "1870" 9 "1873", alternate) 
graph export "priests.png", replace

**		Schuetzvereine. This produces panel b.
reg p_ cathp_64 i.year##c.sv_l DM_t priest_ln i.pv
estadd local rsq=round(e(r2), .01)
estadd local radj=round(e(r2_a), .01)
eststo sv

coefplot, drop(_cons DM_t priest_ln sv_l cathp_64 1852.year 1855.year 1858.year 1861.year 1862.year 1863.year 1866.year 1870.year 1873.year *.pv) vertical yline(0, lc(gs0)) graphregion(color(white)) xlabel(1(1)10, labsize(5)) ylabel(, labsize(5)) name(sv, replace) title("")  ///
xline(0.85, lc(gs8) lp(shortdash_dot)) xline(1.15, lc(gs6) lp(shortdash_dot)) ///
xline(3.85, lc(gs8) lp(shortdash_dot)) xline(4.15, lc(gs6) lp(shortdash_dot)) ///
xline(7.85, lc(gs8) lp(shortdash_dot)) xline(8.15, lc(gs6) lp(shortdash_dot)) ///
xline(8.85, lc(gs8) lp(shortdash_dot)) xline(9.15, lc(gs6) lp(shortdash_dot)) xlabel(1 "1852" 2 "1855" 3 "1858" 4 "1861" 5 "1862" 6 "1863" 7 "1866" 8 "1870" 9 "1873", alternate) 
graph export "SVs.png", replace

******************************************************
** Generate the regression table
******************************************************
label var sv_l "Rifle Clubs"
label var priest_ln "Priests"
esttab sv priest using "mobcap_results.tex", ///
replace b se  obslast order(cathp_64 sv_l priest_ln DM_t) eqlabels(none) compress  ///
title("Mobilization Capacity and the Electoral Performance of the \textit{ Zentrum}") label ///
mtitles("Rifle Clubs" "Priests") note(" ") ///
nobaselevels  b(%9.3f) se(%9.3f) t(%9.1f)  s(controls random  rsq radj N, ///
label("Pre-1865 covariates" "Province FE"  "\(R^{2}\)" "adjusted \(R^{2}\)" "Observations") fmt(%9.0f)) 
************************************************
** Descriptive statistics
*************************************************
label var p_ "Number of Zentrum seats"
sutex p_ cathp_64 sv_l DM_t priest_ln , lab nobs digits(2) key(descriptive_mobcap)  replace ///
file("mobcap_descriptive.tex") title("Summary Statistics Mobilization Capacity") minmax 

*************************************************
** Correlation table
*************************************************
corrtex p_ cathp_64 sv_l DM_t priest_ln, digits(2)  ///
file(correlation_mobcap) title(Correlation Table Mobilization Capacity) replace

